<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<jsp:include page="include/base.jsp"/>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
  <title>怡天网-体检预约</title>
  <meta name="Keywords" content="怡天体检">
  <meta name="Description" content="怡天体检">
  <link rel="stylesheet" href="${Base}/css/weui.css"/>
  <link rel="stylesheet" href="${Base}/css/jquery-weui.css"/>
  <link rel="stylesheet" href="${Base}/css/wx.css"/>
  <script language="JavaScript" src="${Base}/js/reserveinst.js"></script>
</head>
<body>
  <div class="container" id="container">
    <div class="page preview" id="reservePage">
      <div class="page__hd">
      </div>
      <div id="toast" style="display: none;">
        <div class="weui-mask_transparent"></div>
        <div class="weui-toast">
          <i class="weui-icon-info-circle weui-icon_toast"></i>
          <p class="weui-toast__content"></p>
        </div>
      </div>
      <div class="page__bd" style="height: 100%;">
        <div class="weui-tab">
          <div class="weui-navbar">
            <div class="weui-navbar__item weui-bar__item_on">
              我的预约
            </div>
            <div class="weui-navbar__item" onclick="window.location='${Base}/wx/toReserve'">
              预约体检（通用）
            </div>
            <div class="weui-navbar__item" onclick="window.location='${Base}/wx/toReserve?mv=reserve-xlt'">
              预约体检(信立泰）
            </div>
          </div>
          <div class="weui-tab__panel">
              <c:forEach items="${list}" var="bean">
              <div class="weui-form-preview">
                <div class="weui-form-preview__hd">
                  <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label" id="${bean.id}_item">
                      <jsp:useBean id="dateValue" class="java.util.Date"/>
                      <jsp:setProperty name="dateValue" property="time" value="${bean.reserveDate*1000}"/>
                      <fmt:formatDate value="${dateValue}" pattern="yyyy-MM-dd"/>
                    </label>
                    <em class="weui-form-preview__value" style="font-size:14px;">
                      <c:if test="${bean.status==null || bean.status=='0'}"><label style="color:red;">未处理</label></c:if>
                      <c:if test="${bean.status!=null && bean.status=='1'}"><label style="color:green;">已预约</label></c:if>
                      <c:if test="${bean.status!=null && bean.status=='-1'}"><label style="color:#666666;">已取消</label></c:if>
                    </em>
                  </div>
                </div>
                <div class="weui-form-preview__bd">
                  <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">城市</label>
                    <span class="weui-form-preview__value">${bean.city}</span>
                  </div>
                  <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">机构</label>
                    <span class="weui-form-preview__value">${bean.institution}</span>
                  </div>
                  <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">分院</label>
                    <span class="weui-form-preview__value">${bean.branch}</span>
                  </div>
                  <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">地址</label>
                    <span class="weui-form-preview__value">${bean.address}</span>
                  </div>
                  <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">姓名</label>
                    <span class="weui-form-preview__value">${bean.name}</span>
                  </div>
                  <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">身份证号</label>
                    <span class="weui-form-preview__value">${bean.identity}</span>
                  </div>
                  <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">手机号</label>
                    <span class="weui-form-preview__value">${bean.mobile}</span>
                  </div>
                  <div class="weui-form-preview__item">
                    <label class="weui-form-preview__label">备注</label>
                    <span class="weui-form-preview__value">${bean.comments}</span>
                  </div>
                </div>
                <c:if test="${bean.status==null || bean.status=='0'}">
                <div class="weui-form-preview__ft">
                  <a class="weui-form-preview__btn weui-form-preview__btn_primary" href="javascript:cancelReserve(${bean.id})">取消</a>
                </div>
                </c:if>
              </div>
              <br/>
              </c:forEach>
          </div>
        </div>
      </div>
      <div class="page__bd">

      </div>
    </div>
  </div>
  <script src="${Base}/js/jquery-2.1.4.js"></script>
  <script src="${Base}/js/form.js"></script>
  <script language="javascript" src="${Base}/js/jquery-weui.js"></script>
  <script language="javascript">
      var $toast = $('#toast');
      var showToast=function(content) {
        $(".weui-toast__content").html(content);
        if ($toast.css('display') != 'none') return;
        $toast.fadeIn(100);
        setTimeout(function () {
          $toast.fadeOut(100);
        }, 1000)
      };
      function cancelReserve(id){
        $.post("${Base}/wx/cancel", {id:id}, function(data){
          if(data.errno == "1"){
            showToast(data.errdesc);
          }else{
            showToast("操作成功");
            setTimeout(function () {
              window.location = window.location.href;
            }, 1000);
          }

        });
      }
  </script>
</body>
</html>
